var script;

function initScriptData(){
	script = {
		stage01:{
			map:[
				[18,18,18,18,18,18,18,18,18,18,18,18,55,55,18,18,18],
				[18,18,18,17,17,17,17,17,17,17,17,17,55,55,17,17,18],
				[18,18,17,17,17,17,18,18,17,17,17,17,55,55,17,17,18],
				[18,17,17,17,18,18,18,18,18,17,17,55,55,17,17,17,18],
				[18,17,17,18,22,23,23,23,24,18,17,55,55,17,17,17,18],
				[18,17,17,18,25,28,26,79,27,18,55,55,17,17,17,17,18],
				[18,17,17,17,17,10,11,12,18,18,55,55,17,17,17,17,17],
				[18,18,17,17,10,16,16,16,11,55,55,17,17,17,17,17,18],
				[18,18,17,17,77,16,16,16,16,21,21,17,17,17,17,17,18],
				[18,18,17,17,77,16,16,16,16,55,55,17,17,17,17,17,18],
				[18,18,18,18,18,18,18,18,18,55,55,18,18,18,18,18,18]
			],
			mapdata:[
				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
				[1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1],
				[1,1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,1],
				[1,0,0,0,1,1,1,1,1,0,0,1,1,0,0,0,1],
				[1,0,0,1,1,1,1,1,1,1,0,1,1,0,0,0,1],
				[1,0,0,1,1,1,0,1,1,1,1,1,0,0,0,0,1],
				[1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0],
				[1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1],
				[1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
				[1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1],
				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
			],
			add:[
				{chara:"player",data:datalist["player"],row:4,col:4,speed:3,x:5,y:6},
				{chara:"npc",talkIndex:1,data:datalist["npc"],row:4,col:4,speed:3,x:7,y:7},
				{chara:"npc",talkIndex:2,data:datalist["npc"],row:4,col:4,speed:3,x:3,y:3}
			],
			talk:{
				1:[
					{face:datalist["m"],name:"[鸣人]",msg:"我是木叶村的鸣人，你是谁？"},
					{face:datalist["n"],name:"[黑衣忍者甲]",msg:"你就是鸣人？九尾还在你身体里吗？"}
				],
				2:[
					{face:datalist["n"],name:"[黑衣忍者乙]",msg:"鸣人，听说忍者大战就要开始了。"},
					{face:datalist["m"],name:"[鸣人]",msg:"真的吗？一定要想想办法啊。"}
				]
			},
			jump:[
				{at:{x:6,y:5},to:"stage02"},
				{at:{x:16,y:6},to:"stage03"}
			]
		},
		stage02:{
			map:[
				[0,0,1,2,2,2,2,2,2,2,2,1,0,0,0],
				[0,0,1,3,5,5,1,5,5,5,5,1,0,0,0],
				[0,0,1,80,4,4,1,80,4,4,4,1,0,0,0],
				[0,0,1,80,4,4,1,80,8,7,8,1,0,0,0],
				[0,0,1,80,4,4,5,81,4,4,4,1,0,0,0],
				[0,0,1,2,2,2,6,4,4,4,4,1,0,0,0],
				[0,0,1,3,5,5,81,4,4,4,4,1,0,0,0],
				[0,0,1,80,4,4,4,4,4,4,9,1,0,0,0],
				[0,0,1,2,2,2,2,6,2,2,2,1,0,0,0]
			],
			mapdata:[
				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
				[1,1,1,0,0,0,1,0,0,0,0,1,1,1,1],
				[1,1,1,0,0,0,1,0,0,0,0,1,1,1,1],
				[1,1,1,0,0,0,1,0,0,1,0,1,1,1,1],
				[1,1,1,0,0,0,0,0,0,0,0,1,1,1,1],
				[1,1,1,1,1,1,0,0,0,0,0,1,1,1,1],
				[1,1,1,0,0,0,0,0,0,0,0,1,1,1,1],
				[1,1,1,0,0,0,0,0,0,0,1,1,1,1,1],
				[1,1,1,1,1,1,1,0,1,1,1,1,1,1,1]
			],
			add:[
				{chara:"player",data:datalist["player"],row:4,col:4,speed:3,x:7,y:8},
				{chara:"npc",talkIndex:1,data:datalist["npc"],row:4,col:4,speed:3,x:8,y:3},
				{chara:"npc",talkIndex:2,data:datalist["npc"],row:4,col:4,speed:3,x:10,y:3}
			],
			talk:{
				1:[
					{face:datalist["m"],name:"[鸣人]",msg:"你们在干什么啊？"},
					{face:datalist["n"],name:"[黑衣忍者甲]",msg:"我们在喝茶。"}
				],
				2:[
					{face:datalist["n"],name:"[黑衣忍者乙]",msg:"我们在喝茶，你不要打扰我们。"},
					{face:datalist["m"],name:"[鸣人]",msg:"....."}
				]
			},
			jump:[
				{at:{x:7,y:8},to:"stage01"}
			]
		},
		stage03:{
			map:[
				[55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55],
				[55,55,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19],
				[55,55,19,19,19,18,19,19,18,18,18,18,17,17,17,17,19],
				[55,55,55,19,19,19,19,19,19,18,18,17,17,17,19,19,19],
				[55,19,55,19,19,18,19,19,18,19,17,17,17,17,19,18,19],
				[55,19,19,19,19,19,18,19,18,19,17,17,17,17,19,19,19],
				[10,11,11,11,11,11,11,12,17,17,17,17,17,17,19,18,19],
				[55,19,19,19,19,19,19,16,11,56,57,17,17,17,19,19,19],
				[55,18,17,17,77,16,16,16,16,55,55,17,17,17,19,19,19],
				[55,19,17,17,77,16,16,16,16,55,55,18,18,19,19,19,18],
				[55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55]
			],
			mapdata:[
				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
				[1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1],
				[1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1],
				[1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1],
				[1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1],
				[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1],
				[1,1,1,1,1,1,1,0,0,1,1,0,0,0,1,1,1],
				[1,1,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1],
				[1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1],
				[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
			],
			add:[
				{chara:"player",data:datalist["player"],row:4,col:4,speed:3,x:1,y:6},
				{chara:"npc",talkIndex:1,data:datalist["npc"],row:4,col:4,speed:3,x:8,y:7}
			],
			talk:{
				1:[
					{face:datalist["m"],name:"[鸣人]",msg:"这是哪里？好美啊。"},
					{face:datalist["n"],name:"[黑衣忍者甲]",msg:"这里是红树林"}
				]
			},
			jump:[
				{at:{x:0,y:6},to:"stage01"}
			]
		}
	};
}

function initScript(){
	map = stage.map;
	mapData = stage.mapdata;
	talkContent = stage.talk;
	charaList = stage.add;
	jumpTo = stage.jump;
	
	backLayer.removeAllChild();
	addScene();
}